interface Person {
  name: string;
}
interface Concat {
  tel: string;
}

type PersonDetail = Person & Concat;

let p1: PersonDetail = {
  name: "张三",
  tel: "10010",
};
console.log(p1);

// interface A {
//   fn: (value: number) => string;
// }
// interface B extends A {
//   fn: (value: string) => string;
// }
// let p3: B = {
//   fn: (value: number | string) => {
//     console.log(value);
//     return "";
//   },
// };
// p3.fn("88");

interface C {
  fn: (value: number) => string;
}
interface D {
  fn: (value: string) => string;
}

type E = C & D; //类型交叉, 函数为联合类型,或number或string

let p2: E = {
  fn: (value: number | string) => {
    console.log(value);
    return "admin";
  },
};

p2.fn("9999");
